package org.hardstone.service.impl;

import org.hardstone.dao.BaseCategoryDAO;
import org.hardstone.domain.BaseCategoryDomain;
import org.hardstone.service.BaseCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;

import java.io.Serializable;
import java.util.List;
import java.util.Optional;

public class BaseCategoryServiceImpl<T extends BaseCategoryDomain<PK>, PK extends Serializable, DAO extends BaseCategoryDAO<T, PK>> implements BaseCategoryService<T, PK> {
    protected DAO dao;

    @Autowired
    public BaseCategoryServiceImpl(DAO dao) {
        this.dao = dao;
    }

    @Override
    public List<T> findAll(Example<T> ex) {
        return dao.findAll(ex);
    }

    @Override
    public <S extends T> S save(S var1) {
        return dao.save(var1);
    }

    @Override
    public <S extends T> Iterable<S> saveAll(Iterable<S> var1) {
        return dao.saveAll(var1);
    }

    @Override
    public Optional<T> findById(PK var1) {
        return dao.findById(var1);
    }

    @Override
    public boolean existsById(PK var1) {
        return dao.existsById(var1);
    }

    @Override
    public Iterable<T> findAll() {
        return dao.findAll();
    }

    @Override
    public Iterable<T> findAllById(Iterable<PK> var1) {
        return dao.findAllById(var1);
    }

    @Override
    public void deleteById(PK var1) {
        dao.deleteById(var1);
    }

    @Override
    public void delete(T var1) {
        dao.delete(var1);
    }

    @Override
    public void deleteAll() {
        dao.deleteAll();
    }

    @Override
    public void flush() {
        dao.flush();
    }
}
